Skip to content

Throw an error when a tool has no compatible flavour with the current OS #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

MatteoPologruto
Copy link
Contributor

The fwuploader currently crashes if a tool is not available for the OS. With this fix, it throws an error instead.

@MatteoPologruto MatteoPologruto added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Aug 22, 2023
@MatteoPologruto MatteoPologruto self-assigned this Aug 22, 2023
@MatteoPologruto MatteoPologruto linked an issue Aug 22, 2023 that may be closed by this pull request
3 tasks
@MatteoPologruto MatteoPologruto merged commit 45b115d into arduino:main Aug 22, 2023
Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I've also tested locally with success. 🚀

@@ -45,6 +45,11 @@ import (
// DownloadTool downloads and returns the path on the local filesystem of a tool
func DownloadTool(toolRelease *cores.ToolRelease) (*paths.Path, error) {
resource := toolRelease.GetCompatibleFlavour()
if resource == nil {
err := fmt.Errorf("tool %s not available for this OS", toolRelease.String())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err := fmt.Errorf("tool %s not available for this OS", toolRelease.String())
err := fmt.Errorf("tool %s not available for this OS/ARCH", toolRelease.String())

@MatteoPologruto MatteoPologruto deleted the missing-tool-crash branch August 22, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fwupload crash if the tools for the current OS are missing
3 participants